<%@page import="com.carrental.entity.User"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">
	*{
		margin: 0;
		padding: 0;
	}
	
	html,body{
		width: 100%;
		height: 100%;
		background-color: #f2f2f2;
	}
	
	.head{
		width: 100%;
		height: 50px;
		line-height: 50px;
		background-color: #FA8258;
		color: #ffffff;
	}
	.head-content{
		width: 900px;
		margin: auto;
	}
	.head-content h2{
		float: left;
		margin-right: 10px;
	}
	.head-content a{
		float: left;
		margin-right: 10px;
	}
	.main{
		width: 100%;
	}
	.main-content{
		padding: 20px;
		width: 900px;
		margin: auto;
		background: #ffffff;
	}
	
	table{
		width: 50%;
	}
	table tr{
		height: 50px;
	}
	.select-button{
		width: 100px;
		height: 30px;
	}
</style>
</head>
<body>
	<div class="head">
		<div class="head-content">
			<h2>汽车租赁网</h2>
			<a href="index.jsp">首页</a>
			<a href="carRentalList.jsp">我的订单</a>
			<a href="userUpdate.jsp">个人信息</a>
			<a href="LogoutServlet">退出</a>
		</div>
	</div>
	<div class="main">
		<div class="main-content">
			<%
				User user = (User) request.getSession().getAttribute("user");
			%>
			<form action="UserUpdateServlet" method="post">
				<h2>修改个人信息</h2>
				<span style="color: red">
				<%
					String errorCode = request.getParameter("code");
					if (errorCode == null) {
						
					} else if (errorCode.equals("0000")) {
						out.print("修改成功！");
					} else if (errorCode.equals("0002")) {
						out.print("两次密码输入不一致");
					} else if (errorCode.equals("1111")) {
						out.print("修改失败，请重试！");
					}
					
				%>
				</span>
				<table>
					<tr>
						<td>用户名</td>
						<td>
							<input class="form-item" name="username" type="text" value="<%=user.getUsername()%>">
						</td>
					</tr>
					<tr>
						<td>密码</td>
						<td>
							<input class="form-item" name="password" type="password">
						</td>
					</tr>
					<tr>
						<td>确认密码</td>
						<td>
							<input class="form-item" name="password2" type="password">
						</td>
					</tr>
					<tr>
						<td>手机号</td>
						<td>
							<input class="form-item" name="phone" type="text" value="<%=user.getPhone()%>">
						</td>
					</tr>
					<tr>
						<td colspan="2">
							<button class="select-button">修改</button>
						</td>
					</tr>
				</table>
			</form>
		</div>
	</div>
</body>
</html>